export function uniChooseImg() {
  return new Promise((resolve, reject) => {
    uni.chooseImage({
      count: 9, //默认9
      sizeType: ["original", "compressed"], //可以指定是原图还是压缩图，默认二者都有
      sourceType: ["album"], //从相册选择
      success: function (res) {
        resolve(res.tempFiles);
      },
      fail: function (err: any) {
        reject(err);
      },
    });
  });
}

export function uniChooseMedia(
  { count = 9, mediaType = ["image", "video"] } = {} as any
) {
  return new Promise((resolve, reject) => {
    uni.chooseMedia({
      count,
      mediaType,
      sourceType: ["album", "camera"],
      maxDuration: 30,
      camera: "back",
      success: (res) => {
        resolve(res.tempFiles.map((o) => o.tempFilePath));
      },
      fail: reject,
    });
  });
}
